import request from './request'

export interface Banner {
  id: number
  title: string
  imageUrl: string
  link?: string
  description?: string
  sortOrder: number
  isActive: boolean
  isMain: boolean
  createdAt: string
  updatedAt: string
}

// 获取所有激活的轮播图
export function getActiveBanners() {
  return request({
    url: '/banners',
    method: 'get'
  })
}

// 获取主轮播图
export function getMainBanners() {
  return request({
    url: '/banners/main',
    method: 'get'
  })
}

// 根据ID获取轮播图
export const getBannerById = (id: number) => {
  return request({
    url: `/banners/${id}`,
    method: 'get'
  })
}

// 创建轮播图
export const createBanner = (data: any) => {
  return request({
    url: '/banners',
    method: 'post',
    data
  })
}

// 更新轮播图
export const updateBanner = (id: number, data: any) => {
  return request({
    url: `/banners/${id}`,
    method: 'put',
    data
  })
}

// 删除轮播图
export const deleteBanner = (id: number) => {
  return request({
    url: `/banners/${id}`,
    method: 'delete'
  })
} 